package com.aloda.controller.admin;

import com.aloda.dto.EmpLoginDTO;
import com.aloda.result.Result;
import com.aloda.service.EmpService;
import com.aloda.vo.EmpLoginVO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 员工管理端controller
 */
@Slf4j
@RestController
@Tag(name = "管理端员工相关接口")
@RequestMapping("/admin/emp")
public class EmpController {

    @Resource
    private EmpService empService;

    /**
     * 员工后台登录
     * @param empLoginDTO
     * @return
     */
    @Operation(summary = "员工登录")
    @PostMapping("/login")
    public Result<EmpLoginVO> empLogin(@RequestBody EmpLoginDTO empLoginDTO) {
        log.info("员工登录:{}",empLoginDTO);
        EmpLoginVO empLoginVO = empService.empLogin(empLoginDTO);
        return Result.success("登录成功",empLoginVO);
    }
}
